<?php
namespace Modules\AuthAdmin\Http\Controllers\v1;
use Illuminate\Http\Request;
use Modules\AuthAdmin\Http\Requests\PwdRequest;
use Modules\AuthAdmin\Models\AuthConfig as AuthConfigModel;
use Modules\AuthAdmin\Models\AuthAdmin as AuthAdminModel;
class IndexController extends CommonController
{		
	/**	 
	 * @name  刷新token
	 * @method  PUT	
	 * @return  JSON	
	 */
    public function refresh()
    {
        return (new AuthAdminModel())->refresh();
    }
	/**	 
	 * @name  退出登录
	 * @method  DELETE
	 * @return  JSON	
	 */
    public function logout()
    {
		return (new AuthAdminModel())->logout();
    }
	/**	 
	 * @name  获取左侧栏
	 * @method  GET
	 * @return  JSON	
	 */
    public function menu()
    {
		return (new AuthAdminModel())->menu();
    }	
	/**
	 * @name  初始化密码
	 * @method  PUT	
	 * @param  y_password string 原密码	
	 * @param  password string 密码	
	 * @param  password_confirmation string 确认密码	
	 * @return  JSON
	 */ 
    public function upadte_pwd_view(PwdRequest $request)
    {
		$data = $request->all();
		return (new AuthAdminModel())->upadte_pwd_view([
			'y_password'=>$data['y_password'],
			'password'=>$data['password'],
		]); 
    }
	/**	 
	 * @name  清除缓存
	 * @method  DELETE
	 * @return  JSON	
	 */
    public function out_cache()
    {
		return (new AuthConfigModel())->out_cache();
    }
	/**	 
	 * @name  获取平台信息
	 * @method  GET
	 * @return  JSON	
	 */
    public function main()
    {
		return (new AuthConfigModel())->main();
    }
}
